#!/usr/bin/bash
# configuration :
#
# env.LOGFILE /var/log/proftpd/proftpd.log

if [ "$1" = 'config' ]; then
	echo "graph_args --base 1000 -l 0"
	echo "graph_title ProFTP"
	echo "graph_category Ftp"
	echo "graph_vlabel Stats Proftpd"
	echo "succes.label Login succes"
	echo "failed.label Login failed"
	echo "unknown.label Login unknown"
fi

PATH=/opt/local/bin:${PATH}
LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"}

succes=$(grep -c "successful" "$LOGFILE")
failed=$(grep -c "Login failed" "$LOGFILE")
unknown=$(grep -c "no such user found from" "$LOGFILE")

echo "succes.value $succes"
echo "failed.value $failed"
echo "unknown.value $unknown"

exit 0
